<extend name="Public/common"/>
<block name="othercss">
    <script src="{$theme_path}/localResizeIMG/lib/mobileFix.mini.js?v=ad62f13"></script>
    <script src="{$theme_path}/localResizeIMG/lib/exif.js?v=dd609b9"></script>
    <script src="{$theme_path}/localResizeIMG/lrz.js?v=3d33fcf"></script>    
</block>
<block name="header">
<div class="header">
    <div class="clearfix box">
        <!--<a class="save">保存</a>-->
        <a class="return" href="javascript:history.back(-1)"><i class="return-icon"></i></a>
        <h2>账户信息</h2>
    </div>
</div>
</block>
<block name="body">

<!--end header-->
<div class="container pt50">
    <a class="clearfix header-icon vip8_1">
        <div class="right">
            <img src="__ROOT__{$headpic}"  onerror='this.src="{$theme_path}/images/h1.jpg"' onclick="uploadphoto.click()"  id="img_path2" />
        </div>
        <div class="left">头像</div>
    </a>
    <input type="hidden" value="{$headpic}" name="headpic" id="headpic" />
     <input type="file" id="uploadphoto" name="uploadfile" value="请点击上传图片"   style="display:none;" /> 
     <input type="submit"  style="display:none" class="sub" value="保存"/>
    <ul class="header-icon-form">
        <li class="on">
            <a class="clearfix header-icon"  >
                <div class="right">
                   {$member['phone']==''?'未设置':$member['phone']}
                </div>
                <div class="left ">手机号码</div>
            </a>
        </li>
        <li class="edit">
            <a class="clearfix header-icon"  href="{:urlrotue('Member/edit_other',Array('typeid'=>1))}">
                <div class="right">
                    {$member.nickname}
                </div>
                <div class="left">昵称</div>
            </a>
        </li>
        <li class="edit">
            <a class="clearfix header-icon"  href="{:urlrotue('Member/edit_other',Array('typeid'=>2))}">
                <div class="right">
                {$memberinfo.realname}
                </div>
                <div class="left">真实姓名</div>
            </a>
        </li>
                <li class="edit">
            <a class="clearfix header-icon"  href="{:urlrotue('Member/edit_other',Array('typeid'=>6))}">
                <div class="right">
                {$memberinfo.idno}
                </div>
                <div class="left">身份证号码</div>
            </a>
        </li>
        <li>
            <a class="clearfix header-icon" href="{:urlrotue('Member/edit_other',Array('typeid'=>3))}" >
                <div class="right">
                  {$memberinfo.sex}
                </div>
                <div class="left">性别</div>
            </a>
        </li>
    
        <li>
            <a class="clearfix header-icon" href="{:urlrotue('Member/edit_other',Array('typeid'=>4))}" >
                <div class="right"><if condition="$memberinfo['year'] neq ''">
                   {$memberinfo['year']}年{$memberinfo['month']}月{$memberinfo['day']}
                     <else/>
                     未选择
                      </if>
                </div>
                <div class="left">生日</div>
            </a>
        </li>
    </ul>
    <ul class="header-icon-form">
        <li>
            <a class="clearfix header-icon"  href="{:urlrotue('Member/edit_other',Array('typeid'=>5))}">
                <div class="right">
                <if condition="$memberinfo['province'] neq ''">
                {$memberinfo.province} {$memberinfo.city} {$memberinfo.area} {$memberinfo.address}
                <else/>
                未填写
                </if>
                </div>
                <div class="left">所在地</div>
            </a>
        </li>
  
    </ul>
  <div><a href="{:urlrotue('Register/logout')}" style="text-align:center; margin-top:10px; display:block; line-height:45px; font-size:16px; background-color:#dd2727; color:#fff">退出登录</a></div>

</div>
  


</block>
<block name="otherjs">
                     
<script type="text/javascript">
        //var pic_index = $("#pic_index").val();
        $(document).ready(function (e) {
            //单图上传
           // var pic_index = $("#pic_index").val();
			
            var uploadphoto = document.getElementById('uploadphoto');
			
            uploadphoto.onchange = function () {
                lrz(this.files[0], {width: 350,height:350}, function (results) {
                    // 你需要的数据都在这里，可以以字符串的形式传送base64给服务端转存为图片。
                    //console.log(results);
                    // 发送到后端
                    var xhr = new XMLHttpRequest();
                    var data = {
                        base64: results.base64,
                        size: results.base64.length // 校验用，防止未完整接收
                    };
                    xhr.open('POST', "{:urlrotue('Member/upload')}");
					
                    xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
                    xhr.onreadystatechange = function () {
                        if (xhr.readyState === 4 && xhr.status === 200) {
                            var result = JSON.parse(xhr.response);
                           // console.log(result);
                            if (result.error == 2) {
                                alert('你的图片格式为' + result.msg + ',只支持JPG\GIF\PNG图片！');
                               // $("#pic" + pic_index2).remove();
                            } else if (result.error == 1) {
                                alert('图片上传出错，请拍照或重试'+result.msg);
                               // $("#pic" + pic_index2).remove();
                            } else {
                                $("#img_path2").attr('src', '__ROOT__' + result.src+'?v='+ (new Date()).getTime());
								//alert(result.src);
                               // $("#headpic").val(result.src2);
                                //console.log(detail_pic + result.src + ",");
                            }
                        }
                    };
                    xhr.send(JSON.stringify(data)); // 发送base64
                });
            };
			});
			</script>

</block>
